﻿function previous() {
    history.go(-1);
}

function next() {
    var firstname = document.getElementById("textFirstname").value;
    var lastname = document.getElementById("textLastname").value;
    var birthdayDay = parseInt(document.getElementById("textBirthdayDay")).value;
    var birthdayMonth = parseInt(document.getElementById("textBirthdayMonth")).value;
    var birthdayYear = parseInt(document.getElementById("textBirthdayYear")).value;
    var endDateDay = parseInt(document.getElementById("textEndDateDay")).value;
    var endDateMonth = parseInt(document.getElementById("textEndDateMonth")).value;
    var endDateYear = parseInt(document.getElementById("textEndDateYear")).value;

    if ((firstname.length > 0) && (lastname.length > 0)) {
        if ((birthdayDay > 0) && (birthdayDay < 32) && (birthdayMonth > 0) && (birthdayMonth < 13) && (birthdayYear > 0) && (birthdayYear < 9999)) {
            if ((endDateDay > 0) && (endDateDay < 32) && (endDateMonth > 0) && (endDateMonth < 13) && (endDateYear > 0) && (endDateYear < 9999)) {
                var birthday = birthdayDay + "-" + birthdayMonth + "-" + birthdayYear;
                var endDate = endDateDay + "-" + endDateMonth + "-" + endDateYear;
                var queryString = "paysubscription.aspx?firstname=" + firstname + "&lastname=" + lastname + "&birthday=" + birthday + "&enddate=" + endDate;

                window.location(queryString);
            } else {
                alert("U heeft een ongeldige verloopdatum ingevuld.");
            }
        } else {
            alert("U heeft een ongeldige geboortedatum ingevuld.");
        }
    } else {
        alert("U heeft niet alle velden ingevuld.");
    }    
}